<%--
  Created by IntelliJ IDEA.
  User: 13437
  Date: 2023/9/4
  Time: 13:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>菜谱管理</title>
    <link rel="stylesheet" href="/static/plugins/layui2.7.6/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <%--头部与左侧样式--%>
    <jsp:include page="../commons/head.jsp"/>

        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px;">

                <div class="layui-row">

                    <c:forEach var="menu" items="${menus}" >
                        <div class="layui-col-md3">
                            <img width="200px" height="200px" src="/static/image/${menu.pic}" alt="">
                            <br>
                            <span>${menu.name}</span>
                            <br>
                            <a class="layui-btn" href="/menu/preview?id=${menu.id}">预览</a>
                            <a class="layui-btn layui-btn-green" href="/menu/update?id=${menu.id}">修改</a>
                            <a class="layui-btn layui-btn-danger" href="#">删除</a>
                        </div>
                    </c:forEach>




                </div>
                <br><br><br><br><br>
                <div class="layui-row">
                    <c:if test="${pageNow > 1}"><a href="/menu/findByPage?pageNow=${pageNow - 1}">上一页</a></c:if>

                    <c:forEach var="i"  begin="1" end="${totalPage / 2  + 1}">
                        <a href="/menu/findByPage?pageNow=${i}">${i}</a>
                    </c:forEach>


                    <c:if test="${pageNow < totalPage}"><a href="/menu/findByPage?pageNow=${pageNow + 1}">下一页</a></c:if>

                    一共 ${totalPage} 页
                    ,
                    到第
                    <form action="/menu/findByPage" method="get" style="display: inline">
                        <input type="text" name="pageNow" style="width: 30px" > 页

                        <button type="submit">确定</button>
                    </form>
                </div>

            </div>
        </div>

    <%--引入底部样式--%>
    <jsp:include page="../commons/footer.jsp"/>


</div>

<script src="/static/plugins/layui2.7.6/layui.js"></script>
<script>
    layui.use(['element', 'layer', 'util', 'carousel','upload','table','form'], function () {
        var element = layui.element
            , layer = layui.layer
            , util = layui.util
            , $ = layui.$;
        var carousel = layui.carousel;
        var upload = layui.upload;
        var table = layui.table;
        var form = layui.form;
    });
</script>

</body>
</html>
